package com.gz.mylife.app;

import com.gz.mylife.R;
import com.gz.mylife.util.AsyncBitmapLoader;
import com.gz.mylife.util.AsyncBitmapLoader.ImageCallBack;

import android.R.plurals;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

public class Fragment4 extends Fragment {

	public static ImageView img;
	View view;
	Bitmap bm;
	private AsyncBitmapLoader asyncBitmapLoader;
	private TextView tvInNew;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		super.onCreateView(inflater, container, savedInstanceState);
		view = inflater.inflate(R.layout.fragment_4, container, false);
		tvInNew = (TextView)view.findViewById(R.id.tvInNew);
		img = (ImageView) view.findViewById(R.id.imageView4);
		asyncBitmapLoader = new AsyncBitmapLoader();
		if (SplashScreen.urllist.size() >= 2) {
			String imageURL1 = SplashScreen.urllist.get(1);
			Bitmap bitmap = asyncBitmapLoader.loadBitmap(img, imageURL1,
					new ImageCallBack() {

						@Override
						public void imageLoad(ImageView imageView, Bitmap bitmap) {
							// TODO Auto-generated method stub
							imageView.setImageBitmap(bitmap);
						}
					});
			img.setImageBitmap(bitmap);
		}
		return view;
	}

	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);


		tvInNew.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// 跳转到首页
				startActivity(new Intent(getActivity(), Plaza.class));
				getActivity().finish();
			}
		});
	}

}
